from django.db import models



# Create your models here.

class MyBookshelf(models.Model):
    user = models.CharField(verbose_name="用户", max_length=30)
    book = models.CharField(verbose_name="图书", max_length=30)
    time = models.DateTimeField(verbose_name="加入时间", auto_now_add=True)

    def __str__(self):
        return self.user.username + "\t加入了\t" + self.book.name + "\t到\t我的书架"

    class Meta:
        verbose_name = "我的书架"
        verbose_name_plural = "我的书架"
        unique_together = [['user', 'book']]


